package com.hlm.testredis.controller;

import com.hlm.testredis.mapper.TestDistributeMapper;
import com.hlm.testredis.util.MagicArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @program:test-redis
 * @description:测试 实体类
 * @author: xinY
 * @create:2020-07-29 08:54
 **/
@RestController
public class TestMagicArray {
    @Autowired
    private TestDistributeMapper mapper;
    @Value("${excelPath3}")
    private  String path;
    @GetMapping("/test")
    public void testMagic(){
        List<Double> totalList = mapper.findList4allRoomTemp();
        double[] metas = new double[totalList.size()];
        for(int i = 0 ; i < totalList.size() ; i ++){
            metas[i] = totalList.get(i);
        }
        MagicArray magicArray = new MagicArray(metas,15,3);
        Map<Double,Integer> resultMap = magicArray.countPerGroup();
        System.out.println(resultMap.size());
    }
}
